package com.itheima.streamliu;

import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangbaiyan
 * @date 2024-09-17 14:22
 * @description:
 * @version:
 */
public class test {
    public static void main(String[] args) {
        //创建一个ArrayList集合
        ArrayList<String> list = new ArrayList<>();
        //2.添加以下字符串
        list.add("张三,23");
        list.add("李四,24");
        list.add("王五,25");

        Map<String, Integer> newMap  = list.stream().filter(s -> Integer.parseInt(s.split(",")[1]) >= 24).collect(Collectors.toMap(s -> s.split(",")[0], s -> Integer.parseInt(s.split(",")[1])));
        System.out.println(newMap);
    }




}
